home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / amigadoslibrary / readitem.c < prev    next >
C/C++ Source or Header  |  1996-10-10  |  1KB  |  47 lines

  1. /* ReadItem.c   V1.0   93-03-09                 */
  2. /* ROM library: "dos.library/ReadItem", (V36+)  */
  3. /* Copyright 1993, Anders Bjerin, Amiga C Club  */
  4.  
  5.  
  6. #include <dos/dos.h>
  7. #include <dos/rdargs.h>
  8.  
  9. #include <clib/dos_protos.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12.  
  13. #define BUFFER_SIZE 50
  14.  
  15. UBYTE *version = "$VER: ReadItem V1.0";
  16.  
  17. int main( int argc, char *argv[] );
  18. int main( int argc, char *argv[] )
  19. {
  20.   LONG item_type;
  21.   UBYTE item_name[ BUFFER_SIZE ];
  22.  
  23.  
  24.   /* Collect the first item (argument): */
  25.   item_type = ReadItem( item_name, BUFFER_SIZE, NULL );
  26.  
  27.   while( item_type )
  28.   {
  29.     switch( item_type )
  30.     {
  31.       case ITEM_EQUAL:    printf( "Equal symbol  " ); break;
  32.       case ITEM_ERROR:    printf( "Item ERROR    " ); break;
  33.       case ITEM_UNQUOTED: printf( "Unquoted item " ); break;
  34.       case ITEM_QUOTED:   printf( "Quoted item   " ); break;
  35.       default:            printf( "Unknown item! " );
  36.     }
  37.     printf( "%s\n", item_name );
  38.     
  39.     /* Collect next item: */    
  40.     item_type = ReadItem( item_name, BUFFER_SIZE, NULL );
  41.   }
  42.   printf( "No more items!\n" );
  43.  
  44.   exit( 0 );
  45. }
  46.  
  47.